package com.sk.cardeal.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.cardeal.R;
import com.sk.cardeal.entity.Project;

import java.util.List;

/**
 * Created by sk on 2018/1/15.
 */

public class ProjectAdapter extends BaseQuickAdapter<Project, BaseViewHolder> {

    public ProjectAdapter(int layoutResId, @Nullable List<Project> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Project item) {
        helper.setText(R.id.tv_name, item.getProjectName())
                .setText(R.id.work_price, "工时费：￥" + item.getManHoursPrice())
                .setText(R.id.project_price, "￥" + item.getAfterCutPrice())
                .addOnClickListener(R.id.checkbox);
        if (item.isSelect()) {
            helper.setChecked(R.id.checkbox, true);
        } else {
            helper.setChecked(R.id.checkbox, false);
        }
    }
}
